#include <iostream>
#include <vector>
using namespace std;

class Solution
{
public:
    int maxArea(vector<int>& height)
    {
        int left = 0;
        int right = height.size()-1;
        int v = 0;

        while(left < right)
        {
            v = max(v, min(height[left], height[right])*(right-left) );
            if(height[left] <= height[right])
            {
                left++;
            }
            else
            {
                right--;
            }
        }
        return v;
    }
};